﻿using System;
using System.Diagnostics;

namespace LinkedList
{
    class Program
    {
        static void Main(string[] args)
        {



            System.Collections.Generic.LinkedList<int> ls = new System.Collections.Generic.LinkedList<int>();//微软官方定义的链表 


            Stopwatch timer = new Stopwatch();
            long total = 0;

            timer.Start();
            for (int i = 1; i <= 30000000; i++)
            {
                total += i;
            }


            timer.Stop();
            Console.WriteLine("程序运行{0:F}秒", timer.Elapsed.TotalSeconds);


            //System.Diagnostics.Stopwatch stopwatch = new Stopwatch();
            //stopwatch.Start(); //  开始监视代码运行时间
            ////  you code ....
            //stopwatch.Stop(); //  停止监视
            //TimeSpan timespan = stopwatch.Elapsed; //  获取当前实例测量得出的总时间
            //double hours = timespan.TotalHours; // 总小时
            //double minutes = timespan.TotalMinutes;  // 总分钟
            //double seconds = timespan.TotalSeconds;  //  总秒数
            //double milliseconds = timespan.TotalMilliseconds;  //  总毫秒数


            //Linkedlist<int> linkedList = new Linkedlist<int>();
            //for (int i = 0; i < 5; i++)
            //{
            //    linkedList.addFirst(i);
            //    Console.WriteLine(linkedList);
            //}

            //linkedList.add(2, 666);
            //int csa = linkedList.get(2);
            //Console.WriteLine(linkedList);
            //linkedList.remove(2);
            //Console.WriteLine(linkedList);
            //linkedList.removeFirst();
            //Console.WriteLine(linkedList);

            timer = new Stopwatch();


            timer.Start();






            LinkedlistStack<int> stack = new LinkedlistStack<int>();




            for (int i = 0; i < 5; i++)
            {
                stack.push(i);
                Console.WriteLine(stack);
            }

            int c = stack.pop();
            Console.WriteLine(stack);



            //stack = new LinkedlistStack<int>();
            //int opCount = 10000000;
            //Random random = new Random();
            //for (int i = 0; i < opCount; i++)
            //    stack.push(random.Next(int.MaxValue));
            //for (int i = 0; i < opCount; i++)
            //    stack.pop();
            //timer.Stop();

            //Console.WriteLine("程序运行{0:F}秒", timer.Elapsed.TotalSeconds);




            LinkedListQueue<int> queue = new LinkedListQueue<int>();
            for (int i = 0; i < 10; i++)
            {
                queue.enqueue(i);
                Console.WriteLine(queue);                 
            }

            queue.dequeue();
            Console.WriteLine(queue);







            int[] nums = { 1, 2, 6, 3, 4, 5, 6 };
            ListNode head = new ListNode(nums);//数组转链表
            Console.WriteLine(head);

            ListNode res = new ListNode().removeElements(head, 6);
            Console.WriteLine(head);

            res = new ListNode().removeElements(head, 3);
            Console.WriteLine(head);



        }









    }
}
